import torch

from refiners.conversion.utils import Conversion, Hub, WeightRecipe

diffusers_recipe = WeightRecipe(
    key_map={
        "time_embedding.linear_1": "TimestepEncoder.RangeEncoder.Linear_1",
        "time_embedding.linear_2": "TimestepEncoder.RangeEncoder.Linear_2",
        "down_blocks.2.resnets.0.time_emb_proj": "DownBlocks.Chain_8.ResidualBlock.Chain.RangeAdapter2d.Chain.Linear",
        "down_blocks.2.attentions.0.transformer_blocks.0.attn1.to_out.0": "DownBlocks.Chain_8.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Linear",
        "down_blocks.2.attentions.0.transformer_blocks.0.attn2.to_out.0": "DownBlocks.Chain_8.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Linear",
        "down_blocks.2.resnets.1.time_emb_proj": "DownBlocks.Chain_9.ResidualBlock.Chain.RangeAdapter2d.Chain.Linear",
        "down_blocks.2.attentions.1.transformer_blocks.0.attn1.to_out.0": "DownBlocks.Chain_9.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Linear",
        "down_blocks.2.attentions.1.transformer_blocks.0.attn2.to_out.0": "DownBlocks.Chain_9.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Linear",
        "down_blocks.3.resnets.0.time_emb_proj": "DownBlocks.Chain_11.ResidualBlock.Chain.RangeAdapter2d.Chain.Linear",
        "down_blocks.3.resnets.1.time_emb_proj": "DownBlocks.Chain_12.ResidualBlock.Chain.RangeAdapter2d.Chain.Linear",
        "mid_block.resnets.0.time_emb_proj": "MiddleBlock.ResidualBlock_1.Chain.RangeAdapter2d.Chain.Linear",
        "mid_block.attentions.0.transformer_blocks.0.attn1.to_out.0": "MiddleBlock.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Linear",
        "mid_block.attentions.0.transformer_blocks.0.attn2.to_out.0": "MiddleBlock.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Linear",
        "mid_block.resnets.1.time_emb_proj": "MiddleBlock.ResidualBlock_2.Chain.RangeAdapter2d.Chain.Linear",
        "conv_in": "DownBlocks.Chain_1.Conv2d",
        "controlnet_cond_embedding.conv_in": "DownBlocks.Chain_1.Residual.ConditionEncoder.Chain_1.Conv2d",
        "controlnet_cond_embedding.blocks.0": "DownBlocks.Chain_1.Residual.ConditionEncoder.Chain_2.Conv2d_1",
        "controlnet_cond_embedding.blocks.1": "DownBlocks.Chain_1.Residual.ConditionEncoder.Chain_2.Conv2d_2",
        "controlnet_cond_embedding.blocks.2": "DownBlocks.Chain_1.Residual.ConditionEncoder.Chain_3.Conv2d_1",
        "controlnet_cond_embedding.blocks.3": "DownBlocks.Chain_1.Residual.ConditionEncoder.Chain_3.Conv2d_2",
        "controlnet_cond_embedding.blocks.4": "DownBlocks.Chain_1.Residual.ConditionEncoder.Chain_4.Conv2d_1",
        "controlnet_cond_embedding.blocks.5": "DownBlocks.Chain_1.Residual.ConditionEncoder.Chain_4.Conv2d_2",
        "controlnet_cond_embedding.conv_out": "DownBlocks.Chain_1.Residual.ConditionEncoder.Conv2d",
        "down_blocks.0.resnets.0.norm1": "DownBlocks.Chain_2.ResidualBlock.Chain.GroupNorm_1",
        "down_blocks.0.resnets.0.norm2": "DownBlocks.Chain_2.ResidualBlock.Chain.GroupNorm_2",
        "down_blocks.0.attentions.0.norm": "DownBlocks.Chain_2.CLIPLCrossAttention.Chain_1.GroupNorm",
        "down_blocks.0.resnets.1.norm1": "DownBlocks.Chain_3.ResidualBlock.Chain.GroupNorm_1",
        "down_blocks.0.resnets.1.norm2": "DownBlocks.Chain_3.ResidualBlock.Chain.GroupNorm_2",
        "down_blocks.0.attentions.1.norm": "DownBlocks.Chain_3.CLIPLCrossAttention.Chain_1.GroupNorm",
        "down_blocks.1.resnets.0.norm1": "DownBlocks.Chain_5.ResidualBlock.Chain.GroupNorm_1",
        "down_blocks.0.resnets.0.conv1": "DownBlocks.Chain_2.ResidualBlock.Chain.RangeAdapter2d.Conv2d",
        "down_blocks.0.resnets.0.conv2": "DownBlocks.Chain_2.ResidualBlock.Chain.Conv2d",
        "down_blocks.0.resnets.1.conv1": "DownBlocks.Chain_3.ResidualBlock.Chain.RangeAdapter2d.Conv2d",
        "down_blocks.0.resnets.1.conv2": "DownBlocks.Chain_3.ResidualBlock.Chain.Conv2d",
        "down_blocks.0.downsamplers.0.conv": "DownBlocks.Chain_4.Downsample.Conv2d",
        "down_blocks.0.resnets.0.time_emb_proj": "DownBlocks.Chain_2.ResidualBlock.Chain.RangeAdapter2d.Chain.Linear",
        "down_blocks.0.attentions.0.transformer_blocks.0.ff.net.2": "DownBlocks.Chain_2.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.Linear_2",
        "down_blocks.0.resnets.1.time_emb_proj": "DownBlocks.Chain_3.ResidualBlock.Chain.RangeAdapter2d.Chain.Linear",
        "down_blocks.0.attentions.1.transformer_blocks.0.ff.net.2": "DownBlocks.Chain_3.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.Linear_2",
        "controlnet_down_blocks.0": "DownBlocks.Chain_1.Passthrough.Conv2d",
        "down_blocks.0.attentions.0.proj_in": "DownBlocks.Chain_2.CLIPLCrossAttention.Chain_1.Conv2d",
        "down_blocks.0.attentions.0.proj_out": "DownBlocks.Chain_2.CLIPLCrossAttention.Chain_3.Conv2d",
        "controlnet_down_blocks.1": "DownBlocks.Chain_2.Passthrough.Conv2d",
        "down_blocks.0.attentions.1.proj_in": "DownBlocks.Chain_3.CLIPLCrossAttention.Chain_1.Conv2d",
        "down_blocks.0.attentions.1.proj_out": "DownBlocks.Chain_3.CLIPLCrossAttention.Chain_3.Conv2d",
        "controlnet_down_blocks.2": "DownBlocks.Chain_3.Passthrough.Conv2d",
        "controlnet_down_blocks.3": "DownBlocks.Chain_4.Passthrough.Conv2d",
        "down_blocks.0.attentions.0.transformer_blocks.0.norm1": "DownBlocks.Chain_2.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.LayerNorm",
        "down_blocks.0.attentions.0.transformer_blocks.0.norm2": "DownBlocks.Chain_2.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.LayerNorm",
        "down_blocks.0.attentions.0.transformer_blocks.0.norm3": "DownBlocks.Chain_2.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.LayerNorm",
        "down_blocks.0.attentions.1.transformer_blocks.0.norm1": "DownBlocks.Chain_3.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.LayerNorm",
        "down_blocks.0.attentions.1.transformer_blocks.0.norm2": "DownBlocks.Chain_3.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.LayerNorm",
        "down_blocks.0.attentions.1.transformer_blocks.0.norm3": "DownBlocks.Chain_3.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.LayerNorm",
        "down_blocks.0.attentions.0.transformer_blocks.0.attn1.to_q": "DownBlocks.Chain_2.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_1",
        "down_blocks.0.attentions.0.transformer_blocks.0.attn1.to_k": "DownBlocks.Chain_2.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_2",
        "down_blocks.0.attentions.0.transformer_blocks.0.attn1.to_v": "DownBlocks.Chain_2.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_3",
        "down_blocks.0.attentions.0.transformer_blocks.0.attn2.to_q": "DownBlocks.Chain_2.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_1",
        "down_blocks.0.attentions.1.transformer_blocks.0.attn1.to_q": "DownBlocks.Chain_3.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_1",
        "down_blocks.0.attentions.1.transformer_blocks.0.attn1.to_k": "DownBlocks.Chain_3.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_2",
        "down_blocks.0.attentions.1.transformer_blocks.0.attn1.to_v": "DownBlocks.Chain_3.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_3",
        "down_blocks.0.attentions.1.transformer_blocks.0.attn2.to_q": "DownBlocks.Chain_3.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_1",
        "down_blocks.0.attentions.0.transformer_blocks.0.attn1.to_out.0": "DownBlocks.Chain_2.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Linear",
        "down_blocks.0.attentions.0.transformer_blocks.0.attn2.to_out.0": "DownBlocks.Chain_2.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Linear",
        "down_blocks.0.attentions.1.transformer_blocks.0.attn1.to_out.0": "DownBlocks.Chain_3.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Linear",
        "down_blocks.0.attentions.1.transformer_blocks.0.attn2.to_out.0": "DownBlocks.Chain_3.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Linear",
        "down_blocks.0.attentions.0.transformer_blocks.0.attn2.to_k": "DownBlocks.Chain_2.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_2",
        "down_blocks.0.attentions.0.transformer_blocks.0.attn2.to_v": "DownBlocks.Chain_2.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_3",
        "down_blocks.0.attentions.1.transformer_blocks.0.attn2.to_k": "DownBlocks.Chain_3.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_2",
        "down_blocks.0.attentions.1.transformer_blocks.0.attn2.to_v": "DownBlocks.Chain_3.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_3",
        "down_blocks.0.attentions.0.transformer_blocks.0.ff.net.0.proj": "DownBlocks.Chain_2.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.Linear_1",
        "down_blocks.0.attentions.1.transformer_blocks.0.ff.net.0.proj": "DownBlocks.Chain_3.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.Linear_1",
        "down_blocks.1.resnets.0.conv1": "DownBlocks.Chain_5.ResidualBlock.Chain.RangeAdapter2d.Conv2d",
        "down_blocks.1.resnets.0.time_emb_proj": "DownBlocks.Chain_5.ResidualBlock.Chain.RangeAdapter2d.Chain.Linear",
        "down_blocks.1.resnets.1.time_emb_proj": "DownBlocks.Chain_6.ResidualBlock.Chain.RangeAdapter2d.Chain.Linear",
        "down_blocks.1.resnets.0.norm2": "DownBlocks.Chain_5.ResidualBlock.Chain.GroupNorm_2",
        "down_blocks.1.attentions.0.norm": "DownBlocks.Chain_5.CLIPLCrossAttention.Chain_1.GroupNorm",
        "down_blocks.1.resnets.1.norm1": "DownBlocks.Chain_6.ResidualBlock.Chain.GroupNorm_1",
        "down_blocks.1.resnets.1.norm2": "DownBlocks.Chain_6.ResidualBlock.Chain.GroupNorm_2",
        "down_blocks.1.attentions.1.norm": "DownBlocks.Chain_6.CLIPLCrossAttention.Chain_1.GroupNorm",
        "down_blocks.2.resnets.0.norm1": "DownBlocks.Chain_8.ResidualBlock.Chain.GroupNorm_1",
        "down_blocks.1.resnets.0.conv2": "DownBlocks.Chain_5.ResidualBlock.Chain.Conv2d",
        "down_blocks.1.resnets.1.conv1": "DownBlocks.Chain_6.ResidualBlock.Chain.RangeAdapter2d.Conv2d",
        "down_blocks.1.resnets.1.conv2": "DownBlocks.Chain_6.ResidualBlock.Chain.Conv2d",
        "down_blocks.1.downsamplers.0.conv": "DownBlocks.Chain_7.Downsample.Conv2d",
        "down_blocks.1.resnets.0.conv_shortcut": "DownBlocks.Chain_5.ResidualBlock.Conv2d",
        "down_blocks.1.attentions.0.proj_in": "DownBlocks.Chain_5.CLIPLCrossAttention.Chain_1.Conv2d",
        "down_blocks.1.attentions.0.proj_out": "DownBlocks.Chain_5.CLIPLCrossAttention.Chain_3.Conv2d",
        "controlnet_down_blocks.4": "DownBlocks.Chain_5.Passthrough.Conv2d",
        "down_blocks.1.attentions.1.proj_in": "DownBlocks.Chain_6.CLIPLCrossAttention.Chain_1.Conv2d",
        "down_blocks.1.attentions.1.proj_out": "DownBlocks.Chain_6.CLIPLCrossAttention.Chain_3.Conv2d",
        "controlnet_down_blocks.5": "DownBlocks.Chain_6.Passthrough.Conv2d",
        "controlnet_down_blocks.6": "DownBlocks.Chain_7.Passthrough.Conv2d",
        "down_blocks.1.attentions.0.transformer_blocks.0.norm1": "DownBlocks.Chain_5.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.LayerNorm",
        "down_blocks.1.attentions.0.transformer_blocks.0.norm2": "DownBlocks.Chain_5.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.LayerNorm",
        "down_blocks.1.attentions.0.transformer_blocks.0.norm3": "DownBlocks.Chain_5.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.LayerNorm",
        "down_blocks.1.attentions.1.transformer_blocks.0.norm1": "DownBlocks.Chain_6.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.LayerNorm",
        "down_blocks.1.attentions.1.transformer_blocks.0.norm2": "DownBlocks.Chain_6.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.LayerNorm",
        "down_blocks.1.attentions.1.transformer_blocks.0.norm3": "DownBlocks.Chain_6.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.LayerNorm",
        "down_blocks.1.attentions.0.transformer_blocks.0.attn1.to_q": "DownBlocks.Chain_5.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_1",
        "down_blocks.1.attentions.0.transformer_blocks.0.attn1.to_k": "DownBlocks.Chain_5.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_2",
        "down_blocks.1.attentions.0.transformer_blocks.0.attn1.to_v": "DownBlocks.Chain_5.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_3",
        "down_blocks.1.attentions.0.transformer_blocks.0.attn2.to_q": "DownBlocks.Chain_5.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_1",
        "down_blocks.1.attentions.1.transformer_blocks.0.attn1.to_q": "DownBlocks.Chain_6.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_1",
        "down_blocks.1.attentions.1.transformer_blocks.0.attn1.to_k": "DownBlocks.Chain_6.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_2",
        "down_blocks.1.attentions.1.transformer_blocks.0.attn1.to_v": "DownBlocks.Chain_6.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_3",
        "down_blocks.1.attentions.1.transformer_blocks.0.attn2.to_q": "DownBlocks.Chain_6.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_1",
        "down_blocks.1.attentions.0.transformer_blocks.0.attn1.to_out.0": "DownBlocks.Chain_5.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Linear",
        "down_blocks.1.attentions.0.transformer_blocks.0.attn2.to_out.0": "DownBlocks.Chain_5.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Linear",
        "down_blocks.1.attentions.1.transformer_blocks.0.attn1.to_out.0": "DownBlocks.Chain_6.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Linear",
        "down_blocks.1.attentions.1.transformer_blocks.0.attn2.to_out.0": "DownBlocks.Chain_6.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Linear",
        "down_blocks.1.attentions.0.transformer_blocks.0.attn2.to_k": "DownBlocks.Chain_5.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_2",
        "down_blocks.1.attentions.0.transformer_blocks.0.attn2.to_v": "DownBlocks.Chain_5.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_3",
        "down_blocks.1.attentions.1.transformer_blocks.0.attn2.to_k": "DownBlocks.Chain_6.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_2",
        "down_blocks.1.attentions.1.transformer_blocks.0.attn2.to_v": "DownBlocks.Chain_6.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_3",
        "down_blocks.1.attentions.0.transformer_blocks.0.ff.net.0.proj": "DownBlocks.Chain_5.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.Linear_1",
        "down_blocks.1.attentions.1.transformer_blocks.0.ff.net.0.proj": "DownBlocks.Chain_6.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.Linear_1",
        "down_blocks.1.attentions.0.transformer_blocks.0.ff.net.2": "DownBlocks.Chain_5.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.Linear_2",
        "down_blocks.1.attentions.1.transformer_blocks.0.ff.net.2": "DownBlocks.Chain_6.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.Linear_2",
        "down_blocks.2.resnets.0.conv1": "DownBlocks.Chain_8.ResidualBlock.Chain.RangeAdapter2d.Conv2d",
        "down_blocks.2.resnets.0.norm2": "DownBlocks.Chain_8.ResidualBlock.Chain.GroupNorm_2",
        "down_blocks.2.attentions.0.norm": "DownBlocks.Chain_8.CLIPLCrossAttention.Chain_1.GroupNorm",
        "down_blocks.2.resnets.1.norm1": "DownBlocks.Chain_9.ResidualBlock.Chain.GroupNorm_1",
        "down_blocks.2.resnets.1.norm2": "DownBlocks.Chain_9.ResidualBlock.Chain.GroupNorm_2",
        "down_blocks.2.attentions.1.norm": "DownBlocks.Chain_9.CLIPLCrossAttention.Chain_1.GroupNorm",
        "down_blocks.3.resnets.0.norm1": "DownBlocks.Chain_11.ResidualBlock.Chain.GroupNorm_1",
        "down_blocks.3.resnets.0.norm2": "DownBlocks.Chain_11.ResidualBlock.Chain.GroupNorm_2",
        "down_blocks.3.resnets.1.norm1": "DownBlocks.Chain_12.ResidualBlock.Chain.GroupNorm_1",
        "down_blocks.3.resnets.1.norm2": "DownBlocks.Chain_12.ResidualBlock.Chain.GroupNorm_2",
        "mid_block.resnets.0.norm1": "MiddleBlock.ResidualBlock_1.Chain.GroupNorm_1",
        "mid_block.resnets.0.norm2": "MiddleBlock.ResidualBlock_1.Chain.GroupNorm_2",
        "mid_block.attentions.0.norm": "MiddleBlock.CLIPLCrossAttention.Chain_1.GroupNorm",
        "mid_block.resnets.1.norm1": "MiddleBlock.ResidualBlock_2.Chain.GroupNorm_1",
        "mid_block.resnets.1.norm2": "MiddleBlock.ResidualBlock_2.Chain.GroupNorm_2",
        "down_blocks.2.resnets.0.conv2": "DownBlocks.Chain_8.ResidualBlock.Chain.Conv2d",
        "down_blocks.2.resnets.1.conv1": "DownBlocks.Chain_9.ResidualBlock.Chain.RangeAdapter2d.Conv2d",
        "down_blocks.2.resnets.1.conv2": "DownBlocks.Chain_9.ResidualBlock.Chain.Conv2d",
        "down_blocks.2.downsamplers.0.conv": "DownBlocks.Chain_10.Downsample.Conv2d",
        "down_blocks.3.resnets.0.conv1": "DownBlocks.Chain_11.ResidualBlock.Chain.RangeAdapter2d.Conv2d",
        "down_blocks.3.resnets.0.conv2": "DownBlocks.Chain_11.ResidualBlock.Chain.Conv2d",
        "down_blocks.3.resnets.1.conv1": "DownBlocks.Chain_12.ResidualBlock.Chain.RangeAdapter2d.Conv2d",
        "down_blocks.3.resnets.1.conv2": "DownBlocks.Chain_12.ResidualBlock.Chain.Conv2d",
        "mid_block.resnets.0.conv1": "MiddleBlock.ResidualBlock_1.Chain.RangeAdapter2d.Conv2d",
        "mid_block.resnets.0.conv2": "MiddleBlock.ResidualBlock_1.Chain.Conv2d",
        "mid_block.resnets.1.conv1": "MiddleBlock.ResidualBlock_2.Chain.RangeAdapter2d.Conv2d",
        "mid_block.resnets.1.conv2": "MiddleBlock.ResidualBlock_2.Chain.Conv2d",
        "down_blocks.2.resnets.0.conv_shortcut": "DownBlocks.Chain_8.ResidualBlock.Conv2d",
        "down_blocks.2.attentions.0.proj_in": "DownBlocks.Chain_8.CLIPLCrossAttention.Chain_1.Conv2d",
        "down_blocks.2.attentions.0.proj_out": "DownBlocks.Chain_8.CLIPLCrossAttention.Chain_3.Conv2d",
        "controlnet_down_blocks.7": "DownBlocks.Chain_8.Passthrough.Conv2d",
        "down_blocks.2.attentions.1.proj_in": "DownBlocks.Chain_9.CLIPLCrossAttention.Chain_1.Conv2d",
        "down_blocks.2.attentions.1.proj_out": "DownBlocks.Chain_9.CLIPLCrossAttention.Chain_3.Conv2d",
        "controlnet_down_blocks.8": "DownBlocks.Chain_9.Passthrough.Conv2d",
        "controlnet_down_blocks.9": "DownBlocks.Chain_10.Passthrough.Conv2d",
        "controlnet_down_blocks.10": "DownBlocks.Chain_11.Passthrough.Conv2d",
        "controlnet_down_blocks.11": "DownBlocks.Chain_12.Passthrough.Conv2d",
        "mid_block.attentions.0.proj_in": "MiddleBlock.CLIPLCrossAttention.Chain_1.Conv2d",
        "mid_block.attentions.0.proj_out": "MiddleBlock.CLIPLCrossAttention.Chain_3.Conv2d",
        "controlnet_mid_block": "MiddleBlock.Passthrough.Conv2d",
        "down_blocks.2.attentions.0.transformer_blocks.0.norm1": "DownBlocks.Chain_8.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.LayerNorm",
        "down_blocks.2.attentions.0.transformer_blocks.0.norm2": "DownBlocks.Chain_8.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.LayerNorm",
        "down_blocks.2.attentions.0.transformer_blocks.0.norm3": "DownBlocks.Chain_8.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.LayerNorm",
        "down_blocks.2.attentions.1.transformer_blocks.0.norm1": "DownBlocks.Chain_9.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.LayerNorm",
        "down_blocks.2.attentions.1.transformer_blocks.0.norm2": "DownBlocks.Chain_9.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.LayerNorm",
        "down_blocks.2.attentions.1.transformer_blocks.0.norm3": "DownBlocks.Chain_9.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.LayerNorm",
        "mid_block.attentions.0.transformer_blocks.0.norm1": "MiddleBlock.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.LayerNorm",
        "mid_block.attentions.0.transformer_blocks.0.norm2": "MiddleBlock.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.LayerNorm",
        "mid_block.attentions.0.transformer_blocks.0.norm3": "MiddleBlock.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.LayerNorm",
        "down_blocks.2.attentions.0.transformer_blocks.0.attn1.to_q": "DownBlocks.Chain_8.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_1",
        "down_blocks.2.attentions.0.transformer_blocks.0.attn1.to_k": "DownBlocks.Chain_8.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_2",
        "down_blocks.2.attentions.0.transformer_blocks.0.attn1.to_v": "DownBlocks.Chain_8.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_3",
        "down_blocks.2.attentions.0.transformer_blocks.0.attn2.to_q": "DownBlocks.Chain_8.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_1",
        "down_blocks.2.attentions.1.transformer_blocks.0.attn1.to_q": "DownBlocks.Chain_9.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_1",
        "down_blocks.2.attentions.1.transformer_blocks.0.attn1.to_k": "DownBlocks.Chain_9.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_2",
        "down_blocks.2.attentions.1.transformer_blocks.0.attn1.to_v": "DownBlocks.Chain_9.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_3",
        "down_blocks.2.attentions.1.transformer_blocks.0.attn2.to_q": "DownBlocks.Chain_9.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_1",
        "mid_block.attentions.0.transformer_blocks.0.attn1.to_q": "MiddleBlock.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_1",
        "mid_block.attentions.0.transformer_blocks.0.attn1.to_k": "MiddleBlock.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_2",
        "mid_block.attentions.0.transformer_blocks.0.attn1.to_v": "MiddleBlock.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_1.SelfAttention.Distribute.Linear_3",
        "mid_block.attentions.0.transformer_blocks.0.attn2.to_q": "MiddleBlock.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_1",
        "down_blocks.2.attentions.0.transformer_blocks.0.attn2.to_k": "DownBlocks.Chain_8.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_2",
        "down_blocks.2.attentions.0.transformer_blocks.0.attn2.to_v": "DownBlocks.Chain_8.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_3",
        "down_blocks.2.attentions.1.transformer_blocks.0.attn2.to_k": "DownBlocks.Chain_9.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_2",
        "down_blocks.2.attentions.1.transformer_blocks.0.attn2.to_v": "DownBlocks.Chain_9.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_3",
        "mid_block.attentions.0.transformer_blocks.0.attn2.to_k": "MiddleBlock.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_2",
        "mid_block.attentions.0.transformer_blocks.0.attn2.to_v": "MiddleBlock.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_2.Attention.Distribute.Linear_3",
        "down_blocks.2.attentions.0.transformer_blocks.0.ff.net.0.proj": "DownBlocks.Chain_8.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.Linear_1",
        "down_blocks.2.attentions.1.transformer_blocks.0.ff.net.0.proj": "DownBlocks.Chain_9.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.Linear_1",
        "mid_block.attentions.0.transformer_blocks.0.ff.net.0.proj": "MiddleBlock.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.Linear_1",
        "down_blocks.2.attentions.0.transformer_blocks.0.ff.net.2": "DownBlocks.Chain_8.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.Linear_2",
        "down_blocks.2.attentions.1.transformer_blocks.0.ff.net.2": "DownBlocks.Chain_9.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.Linear_2",
        "mid_block.attentions.0.transformer_blocks.0.ff.net.2": "MiddleBlock.CLIPLCrossAttention.Chain_2.CrossAttentionBlock.Residual_3.Linear_2",
    },
)

tile = Conversion(
    original=Hub(
        repo_id="lllyasviel/control_v11f1e_sd15_tile",
        filename="diffusion_pytorch_model.bin",
        revision="3f877705c37010b7221c3d10743307d6b5b6efac",
        expected_sha256="eb05b4c3665bd76dad70a90652014a9b3aab391abd8a5bb484e860330f9492fb",
    ),
    converted=Hub(
        repo_id="refiners/sd15.controlnet.tile",
        filename="model.safetensors",
        expected_sha256="3002029df75364fcbdbf6024dc4c414c929cb8623a2fe7d406a4dbfcee1ffa5a",
    ),
    recipe=diffusers_recipe,
    dtype=torch.float16,
)
canny = Conversion(
    original=Hub(
        repo_id="lllyasviel/control_v11p_sd15_canny",
        filename="diffusion_pytorch_model.safetensors",
        revision="115a470d547982438f70198e353a921996e2e819",
        expected_sha256="be713fb941fc7c625f0c7d816b6a19115783a665f3049a8974f127e0c075d9a9",
    ),
    converted=Hub(
        repo_id="refiners/sd15.controlnet.canny",
        filename="model.safetensors",
        expected_sha256="0d6d0ba036dc26f4842e89f3c5f2f37feca904863e83b578db099a6fdafc4f51",
    ),
    recipe=diffusers_recipe,
    dtype=torch.float16,
)
depth = Conversion(
    original=Hub(
        repo_id="lllyasviel/control_v11f1p_sd15_depth",
        filename="diffusion_pytorch_model.safetensors",
        revision="539f99181d33db39cf1af2e517cd8056785f0a87",
        expected_sha256="999aca923ca5e19e70e6afc8d11073cc3c03553ca935b636bd5925df4a1c77d1",
    ),
    converted=Hub(
        repo_id="refiners/sd15.controlnet.depth",
        filename="model.safetensors",
        expected_sha256="d131fb2e73e89e56ee1e73b6af17373bba886da6ae24dd94300a93e993292133",
    ),
    recipe=diffusers_recipe,
    dtype=torch.float16,
)
normalbae = Conversion(
    original=Hub(
        repo_id="lllyasviel/control_v11p_sd15_normalbae",
        filename="diffusion_pytorch_model.safetensors",
        revision="cb7296e6587a219068e9d65864e38729cd862aa8",
        expected_sha256="e6c3772b35e5cb1869beca97a6ade6e8e5283310462297b10d129e25351983d7",
    ),
    converted=Hub(
        repo_id="refiners/sd15.controlnet.normalbae",
        filename="model.safetensors",
        expected_sha256="89ac08579cd244cf64bda2045d302d5455b33b951fada4abd089b5defbade364",
    ),
    recipe=diffusers_recipe,
    dtype=torch.float16,
)
lineart = Conversion(
    original=Hub(
        repo_id="lllyasviel/control_v11p_sd15_lineart",
        filename="diffusion_pytorch_model.safetensors",
        revision="8a158f547e031c5b8fbca19ead09a74767ff4db0",
        expected_sha256="d9d6d0e5526dd21dfc503f9e42a93ff1f977aa52df3c14e8ac11085b518cb114",
    ),
    converted=Hub(
        repo_id="refiners/sd15.controlnet.lineart",
        filename="model.safetensors",
        expected_sha256="5fb9ce17b92032c1b7d54aa7fb3c00c067f08e9c024a43cde06999a5a18391cb",
    ),
    recipe=diffusers_recipe,
    dtype=torch.float16,
)
sam = Conversion(
    original=Hub(
        repo_id="mfidabel/controlnet-segment-anything",
        filename="diffusion_pytorch_model.bin",
        revision="22bf4d81a4c7557287815a53e1f55279836e2bfa",
        expected_sha256="9d4f35bb941e35ceeb54e4d6d35c9239949b193e5c7389426b95a97e43de884d",
    ),
    converted=Hub(
        repo_id="refiners/sd15.controlnet.sam",
        filename="model.safetensors",
        expected_sha256="b8e0e1f2b1e542e5a21e21cdadf135981937b9ca491312b75aa85bff63b35589",
    ),
    recipe=diffusers_recipe,
    dtype=torch.float16,
)
